﻿using System.Collections.Generic;
using Metro.Kashikoi.Service.Common.Entity;
using Metro.Kashikoi.ServiceContract.Storage;

namespace Metro.Kashikoi.Service.Storage.Business
{
    /// <summary>
    /// This interface provides methods to manage inventories.
    /// </summary>
    interface IFacade
    {
        /// <summary>
        /// Creates the inventory.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="inventory">The inventory.</param>
        /// <param name="stockAreaId">The stock area id.</param>
        void CreateInventory(IUnitOfWork context, BinInventory inventory, int stockAreaId);

        /// <summary>
        /// Updates the inventory.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="inventory">The inventory.</param>
        void UpdateInventory(IUnitOfWork context, BinInventory inventory);

        /// <summary>
        /// Updates the inventories stock status.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="inventories">The inventories.</param>
        /// <param name="stockStatus">The stock status.</param>
        void UpdateInventoriesStockStatus(IUnitOfWork context, ICollection<BinInventory> inventories, StockStatus stockStatus);

        /// <summary>
        /// Updates the inventory stock status.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="SSID">The SSID.</param>
        /// <param name="stockStatus">The stock status.</param>
        void UpdateInventoryStockStatus(IUnitOfWork context, string SSID, StockStatus stockStatus);

        /// <summary>
        /// Deletes the inventory.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="inventoryId">The inventory id.</param>
        void DeleteInventory(IUnitOfWork context, int inventoryId);

        /// <summary>
        /// Deletes the inventories of stock areas.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="stockAreaIdList">The stock area id list.</param>
        void DeleteInventoriesOfStockAreas(IUnitOfWork context, IEnumerable<int> stockAreaIdList);

        /// <summary>
        /// Deletes the inventories of items.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="itemIdList">The item id list.</param>
        void DeleteInventoriesOfItems(IUnitOfWork context, IEnumerable<int> itemIdList);

        /// <summary>
        /// Gets the inventories of stock areas.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="stockAreaIdList">The stock area id list.</param>
        /// <returns>
        /// A list of the inventories in the specific stock areas.
        /// </returns>
        IList<BinInventory> GetInventoriesOfStockAreas(IUnitOfWork context, IEnumerable<int> stockAreaIdList);

        /// <summary>
        /// Gets the restock list.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="stockAreaIdList">The stock area id list.</param>
        /// <returns>
        /// A list of the inventories which need to be restocked in the specific stock areas.
        /// </returns>
        IList<BinInventory> GetRestockList(IUnitOfWork context, IEnumerable<int> stockAreaIdList);

        /// <summary>
        /// Gets the inventory by Id.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="Id">The id.</param>
        /// <returns>
        /// The inventory with the Id.
        /// </returns>
        BinInventory GetInventoryById(IUnitOfWork context, int Id);

        /// <summary>
        /// Gets the inventory by SSID.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="SSID">The SSID.</param>
        /// <returns>
        /// The inventory with the SSID.
        /// </returns>
        BinInventory GetInventoryBySSID(IUnitOfWork context, string SSID);

        /// <summary>
        /// Gets the inventories by item.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="itemId">The item id.</param>
        /// <returns>
        /// A list of the inventories of the specific item.
        /// </returns>
        IList<BinInventory> GetInventoriesByItem(IUnitOfWork context, int itemId);

        /// <summary>
        /// Clones the inventory.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="inventoryId">The inventory id.</param>
        /// <returns>
        /// The newly created inventory.
        /// </returns>
        BinInventory CloneInventory(IUnitOfWork context, int inventoryId);

        /// <summary>
        /// Clones the inventories of stock area.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="fromStockAreaId">From stock area id.</param>
        /// <param name="toStockAreaId">To stock area id.</param>
        /// <returns>
        /// The newly created inventories.
        /// </returns>
        IList<BinInventory> CloneInventoriesOfStockArea(IUnitOfWork context, int fromStockAreaId, int toStockAreaId);
    }
}
